Skip to content

fix(upgrade): Remove unused getMajorVersion function#5138

Merged
nikosdouvlis merged 3 commits into
mainfrom
lekoarts/eco-403-clerkupgrade-error-in-unused-code
Feb 12, 2025
Merged

fix(upgrade): Remove unused getMajorVersion function#5138
nikosdouvlis merged 3 commits into
mainfrom
lekoarts/eco-403-clerkupgrade-error-in-unused-code

Conversation

@LekoArts

@LekoArts LekoArts commented Feb 12, 2025

Copy link
Copy Markdown
Contributor

Description

A user reported this error while running the upgrade tool on their repo:

Cannot read properties of null (reading '0')

node_modules/@clerk/upgrade/dist/util/get-clerk-version.js:6:43

This comes from these lines:

const clerk = pkg.dependencies.clerk;
return clerk ? semverRegex().exec(clerk)[0][0] : false;

clerk will always be undefined because read-pkg doesn't normalize namespaced packages in such a way. It e.g. returns back dependencies: { '@clerk/nextjs': '^5.11.2', 'read-pkg': '^9.0.1' },.
But for whatever reason for this user the regex is executed.

Anyways, the function is unused anyways and the desired functionality is already fulfilled by the guessFrameworks function.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot

changeset-bot Bot commented Feb 12, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0469244

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/upgrade Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Feb 12, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 12, 2025 11:22am

const [configComplete, setConfigComplete] = useState(false);
const [configVerified, setConfigVerified] = useState(false);
const [uuid, setUuid] = useState();
let fromVersionGuess = false;

@LekoArts LekoArts Feb 12, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't used anywhere, so dead code! This is because further down the file there are commented out code bits but I'm sure they are obsolete now, too

@LekoArts
LekoArts marked this pull request as ready for review February 12, 2025 10:59
@nikosdouvlis
nikosdouvlis merged commit 7076310 into main Feb 12, 2025
@nikosdouvlis
nikosdouvlis deleted the lekoarts/eco-403-clerkupgrade-error-in-unused-code branch February 12, 2025 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants